<template>
	<view class="" v-if="valueCom||showImage">
		<image src="../../../static/goods/share.png" v-if="showImgH5" class="share-img" mode="widthFix"></image>
		<u-popup v-model="valueCom" @close="close" closeable safe-area-inset-bottom mode="bottom" border-radius="20">
			<view class="sku-box pdbJr">
				<view class="store-title mb25">
					分享至
				</view>
				<u-line color="#E5E5E5" />
				<view class="df jcsa mt30 u-text-center mb30">
					<view class="share-item pr">
						<view @click="shareHy">
							<nmr-icon name="weixin1" size="62" color="#28C445"></nmr-icon>
							<view class="mt20">微信好友</view>
						</view>
						<!-- #ifdef MP-WEIXIN -->
						<button class="share-btn pa" open-type="share"></button>
						<!-- #endif -->
					</view>
					<!-- <view class="share-item">
						<view @click="shareImage">
							<nmr-icon name="a-zu7411" size="62" color="#47A848"></nmr-icon>
							<view class="mt20">生成海报</view>
						</view>
					</view> -->
				</view>
			</view>
		</u-popup>
		<u-popup v-model="showImage" @close="closeImg" safe-area-inset-bottom mode="center" border-radius="20">
			<view class="img-box p30">
				<view class="mb30 u-text-center  df aic jcc">
					<image style="width: 42rpx; height: 42rpx;margin-right: 13rpx" src="../../../static/logo.png">
					</image>
					<text class="fs28 fw5 c3">宅美便利</text>
				</view>
				<image :src="posterImg" class="mb30" style="width: 640rpx; height: 775rpx;border-radius: 20rpx;"></image>
				
				<u-button hair-line @click="handleSave"
					:custom-style="{fontSize: '30rpx', color: '#ffffff',width: '630rpx', height: '88rpx',background: '#47A848'}"
					shape='circle' ripple>
					<!-- #ifdef MP-WEIXIN -->
					保存并分享给好友
					<!-- #endif -->
					<!-- #ifdef H5 -->
					长按图片保存到相册
					<!-- #endif -->
					</u-button>
			</view>
		</u-popup>
		

	</view>
</template>

<script>

	export default {
		props: {
			goodsInfo: {
				type: Object,
				default: () => {}
			},
			value: {
				type: Boolean,
				default: false
			},
			posterImg: {
				type: String,
				default: ''
			},
		},
		data() {
			return {
				buyNum: 1,
				valueCom: false,
				showImage: false,
				showImgH5:false
			}
		},
		methods: {
			shareHy(){
				 // #ifdef H5
				console.log('h5分享')
				this.showImgH5 = true
				// #endif
			},
			handleSave() {
				// #ifdef MP-WEIXIN
				this.showImage = false
				this.$emit('handleSave')
				
				this.$emit('input', false)
				// #endif

			},
			shareImage() {
				this.showImage = true
				this.$emit('createPoster')
				this.$emit('input', false)

			},
		
			close() {
				console.log('guan')
				this.showImgH5 = false
				this.$emit('input', false)
			},
			closeImg() {
				this.showImgH5 = false
				this.showImage = false
			}
		},
		watch: {
			value: {
				immediate: true,
				deep: true,
				handler(e) {
					console.log(e,'bainh')
					this.valueCom = e
				},

			}
		}
	}
</script>

<style lang="scss" scoped>


	.img-box {
		background-color: #EAFFEA;
	}

	.store-title {
		margin: 30rpx;
		text-align: center;
		font-size: 28rpx;
		font-family: PingFang SC-Bold, PingFang SC;
		font-weight: bold;
		color: #333333;


	}
</style>